\setcounter{secnumdepth}{10}
\setcounter{tocdepth}{2}
-\usepackage{sabon}
+%\usepackage{sabon}
\def\textos#1{#1}
%
CC := gcc
LD := ld
+
# Linker should relocate monitor to this address
MONITOR_BASE := 0xE0100000
-CFLAGS := -fno-builtin -O3 -Wall -Ih/
+
+# NB. '-Wstrict-prototypes -Wredundant-decls -Wpointer-arith -Winline -ansi'
+# might all be okay to add to Xen. '-Wnested-externs' is a maybe.
+# '-Wcast-qual' is evil.
+CFLAGS := -fno-builtin -O3 -Wall -Ih/ -Wredundant-decls
+CFLAGS += -Wstrict-prototypes -Wnested-externs -Wpointer-arith -Winline -ansi
TARGET := mini-os
-LOBJS:= lib/malloc.o lib/math.o lib/printf.o lib/string.o
-OBJS := entry.o kernel.o traps.o hypervisor.o mm.o events.o time.o ${LOBJS}
+LOBJS := lib/malloc.o lib/math.o lib/printf.o lib/string.o
+OBJS := entry.o kernel.o traps.o hypervisor.o mm.o events.o time.o ${LOBJS}
HINTF := h/hypervisor-ifs/hypervisor-if.h
-HDRS := h/os.h h/types.h h/hypervisor.h h/mm.h h/events.h h/time.h h/lib.h $(HINTF)
+HDRS := h/os.h h/types.h h/hypervisor.h h/mm.h h/events.h h/time.h h/lib.h
+HDRS += $(HINTF)
default: $(TARGET)
* Assembler stubs for hyper-calls.
*/
-static inline int HYPERVISOR_set_trap_table(trap_info_t *table)
+static __inline__ int HYPERVISOR_set_trap_table(trap_info_t *table)
{
int ret;
__asm__ __volatile__ (
return ret;
}
-static inline int HYPERVISOR_mmu_update(mmu_update_t *req, int count)
+static __inline__ int HYPERVISOR_mmu_update(mmu_update_t *req, int count)
{
int ret;
__asm__ __volatile__ (
return ret;
}
-static inline int HYPERVISOR_console_write(const char *str, int count)
+static __inline__ int HYPERVISOR_console_write(const char *str, int count)
{
int ret;
__asm__ __volatile__ (
return ret;
}
-static inline int HYPERVISOR_set_gdt(unsigned long *frame_list, int entries)
+static __inline__ int HYPERVISOR_set_gdt(unsigned long *frame_list, int entries)
{
int ret;
__asm__ __volatile__ (
return ret;
}
-static inline int HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
+static __inline__ int HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
{
int ret;
__asm__ __volatile__ (
return ret;
}
-static inline int HYPERVISOR_set_callbacks(
+static __inline__ int HYPERVISOR_set_callbacks(
unsigned long event_selector, unsigned long event_address,
unsigned long failsafe_selector, unsigned long failsafe_address)
{
return ret;
}
-static inline int HYPERVISOR_net_io_op(netop_t *op)
+static __inline__ int HYPERVISOR_net_io_op(netop_t *op)
{
int ret;
__asm__ __volatile__ (
return ret;
}
-static inline int HYPERVISOR_fpu_taskswitch(void)
+static __inline__ int HYPERVISOR_fpu_taskswitch(void)
{
int ret;
__asm__ __volatile__ (
return ret;
}
-static inline int HYPERVISOR_yield(void)
+static __inline__ int HYPERVISOR_yield(void)
{
int ret;
__asm__ __volatile__ (
return ret;
}
-static inline int HYPERVISOR_exit(void)
+static __inline__ int HYPERVISOR_exit(void)
{
int ret;
__asm__ __volatile__ (
return ret;
}
-static inline int HYPERVISOR_stop(void)
+static __inline__ int HYPERVISOR_stop(void)
{
int ret;
__asm__ __volatile__ (
return ret;
}
-static inline int HYPERVISOR_dom0_op(void *dom0_op)
+static __inline__ int HYPERVISOR_dom0_op(void *dom0_op)
{
int ret;
__asm__ __volatile__ (
return ret;
}
-static inline int HYPERVISOR_network_op(void *network_op)
+static __inline__ int HYPERVISOR_network_op(void *network_op)
{
int ret;
__asm__ __volatile__ (
return ret;
}
-static inline int HYPERVISOR_block_io_op(unsigned int op)
+static __inline__ int HYPERVISOR_block_io_op(unsigned int op)
{
int ret;
__asm__ __volatile__ (
return ret;
}
-static inline int HYPERVISOR_set_debugreg(int reg, unsigned long value)
+static __inline__ int HYPERVISOR_set_debugreg(int reg, unsigned long value)
{
int ret;
__asm__ __volatile__ (
return ret;
}
-static inline unsigned long HYPERVISOR_get_debugreg(int reg)
+static __inline__ unsigned long HYPERVISOR_get_debugreg(int reg)
{
unsigned long ret;
__asm__ __volatile__ (
return ret;
}
-static inline int HYPERVISOR_update_descriptor(
+static __inline__ int HYPERVISOR_update_descriptor(
unsigned long pa, unsigned long word1, unsigned long word2)
{
int ret;
return ret;
}
-static inline int HYPERVISOR_set_fast_trap(int idx)
+static __inline__ int HYPERVISOR_set_fast_trap(int idx)
{
int ret;
__asm__ __volatile__ (
return ret;
}
-static inline int HYPERVISOR_dom_mem_op(void *dom_mem_op)
+static __inline__ int HYPERVISOR_dom_mem_op(void *dom_mem_op)
{
int ret;
__asm__ __volatile__ (
return ret;
}
-static inline int HYPERVISOR_multicall(void *call_list, int nr_calls)
+static __inline__ int HYPERVISOR_multicall(void *call_list, int nr_calls)
{
int ret;
__asm__ __volatile__ (
return ret;
}
-static inline long HYPERVISOR_kbd_op(unsigned char op, unsigned char val)
+static __inline__ long HYPERVISOR_kbd_op(unsigned char op, unsigned char val)
{
int ret;
__asm__ __volatile__ (
return ret;
}
-static inline int HYPERVISOR_update_va_mapping(
+static __inline__ int HYPERVISOR_update_va_mapping(
unsigned long page_nr, unsigned long new_val, unsigned long flags)
{
int ret;
void *realloc(void* p, size_t n);
void *memalign(size_t alignment, size_t n);
void *valloc(size_t n);
-struct mallinfo mallinfo();
+struct mallinfo mallinfo(void);
int mallopt(int parameter_number, int parameter_value);
void **independent_calloc(size_t n_elements, size_t size, void* chunks[]);
void cfree(void* p);
int malloc_trim(size_t pad);
size_t malloc_usable_size(void* p);
-void malloc_stats();
+void malloc_stats(void);
#endif /* _LIB_H_ */
extern unsigned long *phys_to_machine_mapping;
#define pfn_to_mfn(_pfn) (phys_to_machine_mapping[(_pfn)])
#define mfn_to_pfn(_mfn) (machine_to_phys_mapping[(_mfn)])
-static inline unsigned long phys_to_machine(unsigned long phys)
+static __inline__ unsigned long phys_to_machine(unsigned long phys)
{
unsigned long machine = pfn_to_mfn(phys >> PAGE_SHIFT);
machine = (machine << PAGE_SHIFT) | (phys & ~PAGE_MASK);
return machine;
}
-static inline unsigned long machine_to_phys(unsigned long machine)
+static __inline__ unsigned long machine_to_phys(unsigned long machine)
{
unsigned long phys = mfn_to_pfn(machine >> PAGE_SHIFT);
phys = (phys << PAGE_SHIFT) | (machine & ~PAGE_MASK);
#define to_phys(x) ((unsigned long)(x)-VIRT_START)
#define to_virt(x) ((void *)((unsigned long)(x)+VIRT_START))
-void init_mm();
+void init_mm(void);
unsigned long alloc_pages(int order);
#endif /* _MM_H_ */
#define xchg(ptr,v) \
((__typeof__(*(ptr)))__xchg((unsigned long)(v),(ptr),sizeof(*(ptr))))
struct __xchg_dummy { unsigned long a[100]; };
-#define __xg(x) ((struct __xchg_dummy *)(x))
-static inline unsigned long __xchg(unsigned long x, volatile void * ptr,
+#define __xg(x) ((volatile struct __xchg_dummy *)(x))
+static __inline__ unsigned long __xchg(unsigned long x, volatile void * ptr,
int size)
{
switch (size) {
static void exit_handler(int ev, struct pt_regs *regs);
static void debug_handler(int ev, struct pt_regs *regs);
+extern char shared_info[PAGE_SIZE];
static shared_info_t *map_shared_info(unsigned long pa)
{
- extern char shared_info[PAGE_SIZE];
if ( HYPERVISOR_update_va_mapping((unsigned long)shared_info >> PAGE_SHIFT,
pa | 3, UVMF_INVLPG) )
{
if ( ret )
{
num_pages = 1 << order;
- last = ret + (num_pages * PAGE_SIZE);
+ last = (char *)ret + (num_pages * PAGE_SIZE);
}
return ret;
* leading zeros).
*/
u64
-__qdivrem(uq, vq, arq)
- u64 uq, vq, *arq;
+__qdivrem(u64 uq, u64 vq, u64 *arq)
{
union uu tmp;
digit *u, *v, *q;
* Divide two unsigned quads.
*/
u64
-__udivdi3(a, b)
- u64 a, b;
+__udivdi3(u64 a, u64 b)
{
return (__qdivrem(a, b, (u64 *)0));
}
* Return remainder after dividing two unsigned quads.
*/
u_quad_t
-__umoddi3(a, b)
- u_quad_t a, b;
+__umoddi3(u_quad_t a, u_quad_t b)
{
u_quad_t r;
* The buffer pointed to by `nbuf' must have length >= MAXNBUF.
*/
static char *
-ksprintn(nbuf, ul, base, lenp)
- char *nbuf;
- u_long ul;
- int base, *lenp;
+ksprintn(char *nbuf, u_long ul, int base, int *lenp)
{
char *p;
}
/* ksprintn, but for a quad_t. */
static char *
-ksprintqn(nbuf, uq, base, lenp)
- char *nbuf;
- u_quad_t uq;
- int base, *lenp;
+ksprintqn(char *nbuf, u_quad_t uq, int base, int *lenp)
{
char *p;
void * memcpy(void * dest,const void *src,size_t count)
{
- char *tmp = (char *) dest, *s = (char *) src;
+ char *tmp = (char *) dest;
+ const char *s = src;
while (count--)
*tmp++ = *s++;
for(; *s != (char) c; ++s)
if (*s == '\0')
return NULL;
- return (char *) s;
+ return (char *)s;
}
char * strstr(const char * s1,const char * s2)
}
return NULL;
}
-
(shadow_time_version == HYPERVISOR_shared_info->time_version2)
-static inline unsigned long get_time_delta_usecs(void)
+static __inline__ unsigned long get_time_delta_usecs(void)
{
s32 delta_tsc;
u32 low;
}
-static inline void dump_code(unsigned eip)
+static __inline__ void dump_code(unsigned eip)
{
unsigned *ptr = (unsigned *)eip;
int x;
* register CR2, but that is not accessible in a virtualised OS.
*/
-static void inline do_trap(int trapnr, char *str,
+static void __inline__ do_trap(int trapnr, char *str,
struct pt_regs * regs, long error_code)
{
printk("FATAL: Unhandled Trap (see mini-os:traps.c)");
typedef struct xen_disk_info
{
/* IN variables */
- int max; // maximumum number of disks to report
- xen_disk_t *disks; // pointer to array of disk info
+ int max; /* maximumum number of disks to report */
+ xen_disk_t *disks; /* pointer to array of disk info */
/* OUT variables */
- int count; // how many disks we have info about
+ int count; /* how many disks we have info about */
} xen_disk_info_t;
#endif